home *** CD-ROM | disk | FTP | other *** search
/ ShareWare OnLine 2 / ShareWare OnLine Volume 2 (CMS Software)(1993).iso / games1 / fsstruct.zip / FSSTRUCT.TXT < prev   
Text File  |  1992-11-04  |  85KB  |  1,826 lines

  1.  
  2.  
  3.                          MICROSOFT FLIGHT SIMULATOR
  4.                             DATA FILE STRUCTURES
  5.  
  6. INTRODUCTION
  7.  
  8. Document version 2.0, release date: 15 November 1992.
  9. Updates:
  10. ∙ Added static scenery record codes reference
  11. ∙ Completed 5Ah record in mountain description
  12. ∙ Corrected description of 0Bh, 0Eh, 16h, 25h records and "range" records
  13. ∙ Added ATC records and many records used in other kinds of scenery
  14. ∙ Added .DEM and .MOD file structures
  15. Many record codes have been added, and more obscure points have surfaced.
  16.  
  17. Document version 1.0, release date: 15 September 1992.
  18.  
  19. This document describes the structures of files created or provided with
  20. Microsoft Flight Simulator 4.0 and/or the Microsof Aircraft and Scenery
  21. Designer ver 1. The document is ideally addressed to developers and requires
  22. a good knowledge of hex notation and some familiarity with programmingconcepts.
  23.  
  24.  
  25. Conventions:
  26. ∙ The symbol "m" always means meters, while nautical miles are noted by "NM".
  27. ∙ Hex values are marked with an final 'h', non-marked values are decimal, the
  28.   only exception being code dumps in examples which are in hex.
  29. ∙ Within scenery files, all multi-byte values follow the Intel convention:  lower order bytes precede higher order bytes; they are often transcribed as
  30.   a single value restoring the correct digit positions ("53h 07h" means a
  31.   byte value 53h followed by a byte value 07h, while "FFFBh" means a word
  32.   value FFFBh made of a first byte FBh and a second byte FFh).
  33. ∙ Record structure is given in columnar form: in the 1st column the offset
  34.   within the record, in the 2nd the length of each field, in the 3rd the
  35.   description of the field.
  36. ∙ Unindentified or undeciphered (parts of) records are marked with "???".∙ Records fields which have the same value xxxx in all the examples I saw are
  37.   described as "always xxxx ??".
  38. ∙ Fields whose value, when arbitrarely changed by hand, does not affect
  39.   object appearance or behaviour are declared "irrelevant".
  40.  
  41. Additions, corrections or suggestions are welcome. I apologize for English
  42. language errors and inelegancies.
  43. I would like express my debt to Greg Pierson [72520,1775] whose program
  44. DCOD01.EXE has been seminal in my work and to Dan Samuel [70110,434] who
  45. contributed a lot of information.
  46.  
  47.                     Maurizio M. Gavioli
  48.  
  49.           CompuServe: 100021,2335
  50.           InterNet:   "Maurizio M. Gavioli" <VINCIGLI@vm.idg.fi.cnr.it>
  51.  
  52. --------------------------
  53. DISCLAIMER
  54. --------------------------
  55.  
  56. The below information was derived from hours of analysis of FS4/ASD files
  57. (often manually generated for this very purpose).  The FS4/ASD community as awhole has spent way too much time decoding this information in order to
  58. generate useful utilities.  It would be nice if the original authors chose to
  59. publish an "official" documentation of FS data files.  However, the below
  60. information is not distributed with an eye towards enabling anyone to rob the
  61. original authors of any rightful profits and should be used only for the
  62. common good of the FS4 community and to encourage availability and sales of
  63. FS4 and related products and utilities.
  64. ========================================
  65.  
  66.                               GENERAL CONCEPTS
  67.  
  68. FS COORDINATES AND GEOGRAPHIC UNIT
  69.  
  70. FS North and East coordinates are internally coded with code 49,152 (= C000h)
  71. representing coordinate 0; therefore codes from 49,152 to 65,535 (C000h toFFFFh) represent coordinates from 0 to 16,383 and codes from 0 to 49,151
  72. (0000h to BFFFh) represent coordinates from 16,384 to 65,535. The reason for
  73. this coordinate shift is not clear.
  74.  
  75. Within programs, internally coded coordinates can be convert to external FS
  76. coordinated by subtracting 49152 (C000h) from the value considered as
  77. unsigned
  78. Manually, coded coordinates below 49,152 can be converted to FS coordinates
  79. by adding 16,384, and coded coordinates above 49,151 can be converted by
  80. subtracting 49152.
  81.  
  82. Judging from how scenery radii are converted to Km by ASD, 1 FS coordinate
  83. unit (FSu) seems to be very close to 256 meters.
  84.  
  85. Coded coordinates can appear in object definitions in one of three ways:
  86. ∙ INTEGER (2 bytes): a word containing only an integer coordinate (indicated
  87. as "int FSu")
  88.  
  89. ∙ FRACTIONARY (4 bytes): a double word made of a high order word (4th and 3rd
  90. bytes) containing the coordinate integer part and a low order word (2nd and
  91. 1st bytes) containing the fractionary part.  In most cases, the 1st byte is
  92. 0: the fractionary part is therefore expressed in 256th, and each 256th isalmost equal to 1 meter.  Therefore, fractionary coordinates can also be
  93. interpreted as made by 3 high order bytes expressing a distance (from
  94. coordinate origin) in meters and a low order byte containing a fractionary
  95. part in 256th of meter; this is confirmed by altitude fields, because
  96. altitude is almost invariably indicated in this way (with the fractionary
  97. byte left often unfilled). Both interpretations are indicated as "fract FSu".
  98.  
  99. ∙ DELTA (2 bytes): a word representing the difference from an actualcoordinate given elsewhere (usually in a previous ref. point record, see
  100. below); the high order byte (2nd byte) contains the integer part of the
  101. difference and the low order byte (1st byte) the fractionary part; as
  102. fractionary part units are equal to 1 meter, delta coords can also be
  103. interpreted as distance in meters from the reference point. Contrarily to the
  104. other two representations, which are always positive, this representation is
  105. signed, and therefore the maximum possible difference (and the maximum
  106. possible radius of a scenery object) is 32,767 m. This representation isindicated as "delta FSu".
  107.  
  108.  
  109. OBJECT ORIENTATION
  110.  
  111. Some objects, like runways, buildings and aircraft positions, are oriented.
  112. The angle of this orientation is always given relatively to the North axis of
  113. the FS coordinate system. For some kind of cartographic compensation notdiscussed here, this axis is not necessarily the same as the compass North
  114. (this explains why, while flying or slewing in the 0.00 direction, E
  115. coordinate also can slowly change). Directions displayed by FS and ASD are
  116. relative to the compass North and, therefore, there can be a rotation between
  117. the directions as displayed by ASD and as memorized in the files.
  118.  
  119. Unless otherwise stated, orientation or heading fields, as well as "pitch"
  120. and "bank" fields, are 2 bytes long and are expressed in 1/182.04°: 0000h =0°  ->  10000h = 360°
  121.  
  122.  
  123. RECORDS
  124.  
  125. Many kinds of FS data files are made of "records", i.e. chunks whose
  126. structure, contents and meaning are determined by the first record byte
  127. (thereafter called "record code"); records may contain many values(thereafter called "fields"), and, with a few exceptions, the length of the
  128. record is constant for each record code. Records appear in the files one
  129. after the other; given the start point and the structure (or at least the
  130. length) corresponding to each record code, a file can be sequentially parsed
  131. and decoded.
  132.  
  133. Record code meanings may change (and usually do) from a file type to another.
  134. Some file types (as .SC1 and .DY1) start with a non-record coded portion("header") containing general information about the file.
  135.  
  136.  
  137. VARIABLES
  138.  
  139. FS apparently mantains somewhere in memory a set of variables, which affect
  140. the display engine and/or the flight simulation engine.  These variables are
  141. accessed with a value which looks like a memory address (or a table offset)and has been called "variable address". Attested addresses are in the range
  142. 0288h - 031Eh.  Variables can be set and tested from within a scenery file.
  143.  
  144. Attested variable usages are the following:
  145.  
  146. var at    set to         in
  147.  
  148. 0288      0001           fuel boxes028C                     2 = day; 4 = night; 6 = dusk?
  149. 029C                     East plane position?
  150. 029E                     Alt. plane position?
  151. 02A0                     North plane position?
  152. 02E2      colour         surfaces; the colour code is usually repeated in all
  153.                          the four nibbles
  154. 02EF      altit. (in m)  to set the altitude above sea level of current area
  155. 02F6      0001           inner marker02F8      0001           outer markers
  156. 02FA      0001           middle markers
  157. 0312      0001           by SEE, before 20h, 1Fh record list
  158. 031E      0000           mountains
  159. 031E      0001               "
  160.  
  161.  
  162. BYTE OFFSET
  163. Many records contain an offset, pointing to another record. It is used to
  164. state the total length of an object definition (or of a relevant portion of
  165. it) or to provide some forms of inter-record addressing for conditional
  166. (after variable test) or unconditional jumps.  These offsets are indicates as
  167. "bytes offset" and are always relative to first byte (code byte) of the
  168. record which contains them.
  169.  
  170. ======================================================================
  171.  
  172.                          STATIC SCENERY FILES (.SC1)
  173.  
  174. GENERAL STRUCTURE
  175.  
  176. Static scenery files are made of:
  177. ∙ a header containing a lookup table for the various file sections, the
  178.   scenery boundaries, and the scenery name; this header is 73 bytes long;
  179.  
  180. ∙ 9 sections, containing definitions of Navaids, Polygon, Rivers, Roads,
  181.   Lines, Runways, Mountains, Timing gates, and Buildings respectively.  Each
  182.   section is terminated by a single byte code 79h. Consequently, an empty
  183.   scenery file is 82 bytes long: 73 for the header and 1 for the ending byte  of each section.
  184.  
  185. Each object definition is made by records describing the different features
  186. or parts of the object; the great majority of the records have a fixed
  187. length, but objects of variable shape (like polygons) may contain a variable
  188. number of records and have therefore a variable length.
  189.  
  190. In static scenery files, some record codes can have the most significant bitset or reset, without any apparent difference.  Attested cases are always
  191. reported.
  192.  
  193. ====================
  194.  
  195. HEADER STRUCTURE - length: 73 bytes
  196.  
  197. 0         2    file size2         2    0003h (a kind of signature?)
  198. 4         2    002Ah (= 42, pointer to scenery name)
  199. 6         2    0049h (= 73, header length)
  200. 8         2    pointer to Navaid section (always 73)
  201. 10        2    pointer to Polygon section
  202. 12        2    pointer to River section
  203. 14        2    pointer to Road section
  204. 16        2    pointer to Line section18        2    pointer to Runway section
  205. 20        2    pointer to Mountain section
  206. 22        2    pointer to Timing gate section
  207. 24        2    pointer to Building section
  208. 26        4    E coord. of scenery center (fract. FSu: all 4 bytes used)
  209. 30        4    N coord. of scenery center (fract. FSu: all 4 bytes used)
  210. 34        2    scenery radius (int. FSu)
  211. 36        6    always 0 ??42        31   scenery names: up to 30 characters (padded with space, if
  212.                shorter) plus a 0 ending byte
  213.  
  214.  
  215. ====================
  216.  
  217.                             RECORD CODE REFERENCE
  218. Record are listed by code.  Field at offset 0 always contains the record code
  219. and is 1 byte long.
  220.  
  221. Some records are not found in .SC1 files, but have been detected in other
  222. kind of sceneries and have been included for completness (?); usually their
  223. meaning is unknown, only their length has been determined.
  224.  
  225. Records found in SEE enhanced sceneries are marked with SEE, while recordsfound in the default scenery F1 are marked DEF.  These kinds of scenery have
  226. not been completely parsed yet, therefore it cannot be excluded that a record
  227. appears in other scenery kind as well.
  228.  
  229. Record description contributed by Dan Samuel are marked with an DS.
  230.  
  231.  
  232. -- 00h ------DS----- ??? (7 bytes) =SEE=
  233.  
  234. -- 01h ------DS----- ??? (7 bytes) =SEE=
  235.  
  236. -- 02h ------DS----- ??? (7 bytes) =SEE=
  237.  
  238. -- 03h ------DS----- ??? (2 bytes) =SEE=
  239. -- 05h ------------- NDB (11 bytes)
  240.  
  241. 1         2    frequency; BCD coded (ex.: 327 kHZ -> 27h 03h)
  242. 3         4    E coord. (fract. FSu)
  243. 7         4    N coord. (fract. FSu)
  244.  
  245. -- 0Bh ------DS----- Unconditional jump (3/5 bytes)
  246. 1         2    byte offset
  247. [3        2    signature?]
  248.  
  249. This record tells FS to jump over a given amount of bytes, avoiding rendering
  250. some object feature. It is usually used after a test record to providing
  251. branching to another point fo the object definition.
  252.  
  253. This record is very problematic: it is probably only 3 bytes long, but it isalso sometime used to insert in the file some information (a 2-byte
  254. "signature" is a common case) apparently not relevant for the display engine
  255. but in some way useful to the scenery editor (either ASD or SEE or whatever)
  256. for identifying the object been defined.  See also the discussion under
  257. record 0Eh.
  258.  
  259. -- 0E/8Eh ---DS----- Jump over 0Bh record (3 bytes)
  260. 1         2    byte offset
  261.  
  262. This record has a meaning quite similar to 0Bh, but it is attested only for
  263. jumping above a 0Bh record.  The length at offset 1 is either 0006h or 0008h,
  264. for 0Bh records 3 or 5 bytes long resp.
  265.  
  266. Records 0Eh and 0Bh are often used within many object definitions in a
  267. particular construct:
  268. 0         1    0Eh: record code
  269. 1         2    0006h (when there is no "signature") or 0008h (when there is a
  270.                "signature")
  271. 3         1    0Bh: record code
  272. 4         2    lenght
  273. [6        2    "signature" corresponding to the type of the object being
  274.                defined]
  275. The given length is the length of the remainder of the object definition or
  276. of a part of it; this length, added to the offset of the 0Bh record code
  277. byte, points to a single byte 19h record.
  278.  
  279. This construct has been cumulatively called "variable structure construct"
  280. and the 19h record "end of variable structure record".
  281. -- 0Fh ------------- ?? (6 bytes) =DEF=
  282.  
  283. -- 12h ------------- Line Colour (2 bytes)
  284.  
  285. 1         1    colour code from the following table:
  286.  
  287.                0         Black
  288.                1         Dark Green               2         Dark Blue
  289.                3         Dark Cyan
  290.                4         Orange
  291.                5         Light Grey
  292.                6         Light Blue
  293.                7         Cyan
  294.                8         Brown
  295.                9         Yellow               Ah        Dark Grey
  296.                Bh        Light Green
  297.                Ch        Red
  298.                Dh        Gold
  299.                Eh        (apparently not used/transparent?)
  300.                Fh        White
  301.  
  302. -- 13h ------------- ?? (15 bytes) =DEF=
  303. -- 14h ------------- ?? (10 bytes) =SCN=
  304.  
  305. -- 15h ------DS----- Orientation/delta point (16 bytes) =SEE=
  306.  
  307. 1         2    "pitch" ?
  308. 3         2    "bank" ?
  309. 5         2    heading7         2    E coord. (delta FSu)
  310. 9         2    A coord. (delta FSu)
  311. 11        2    N coord. (delta FSu)
  312. 13        2    always 0010h ??
  313. 15        1    always 19h ??
  314.  
  315. -- 16h ------------- Orientation (9 bytes)
  316. 0         1    16h: record code
  317. 1         2    "pitch" (noze down is positive, noze up is negative)
  318. 3         2    "bank" (left is positive, right is negative)
  319. 5         2    orientation or heading
  320. 7         2    always 000A ??
  321.  
  322. "Pitch" and "bank" come from an airplane analogy and describe object tilting
  323. as if it were an airplane.  Orientation is relative to the North coordinateaxis, not to the compass North.
  324.  
  325. -- 17h ------------- ?? (1 byte)
  326.  
  327. This single byte record has been observed only in timing gate definitions.
  328.  
  329. -- 18h ------------- ?? (3 bytes) =DEF=
  330. -- 19h ------------- End of structure (1 byte)
  331.  
  332. This record, made of the single byte 19h, marks the end of a variable
  333. structure contruct (0Eh + 0Bh).
  334.  
  335. -- 1Ah ------------- ?? (5 bytes) =DEF=
  336.  
  337. -- 1Dh ------------- VOR (11 bytes)
  338. 1         2    frequency; BCD coded (ex.: 109.15 MHz -> 15h 09h)
  339. 3         4    E coord. (fract. FSu)
  340. 7         4    N coord. (fract. FSu)
  341.  
  342. -- 1Eh xxxx -------- ATC message (xxxx bytes)
  343.  
  344. 1         2    record length3         2    frequency; BCD coded (ex.: 127.15 MHz -> 15h 27h)
  345. 5         4    4 runway numbers (often repeated)
  346. 9         4    fixed: 1Eh 37h 52h 3Ch
  347. 13        var  message text (0-terminated)
  348.  
  349. The message text can include any character from ASCII 20h to ASCII 93h.
  350. Characters greater than 93h result in garbage being transmitted. When the
  351. message is played back, characters from 80h to 93h are expanded into thefollowing strings (stored in ATC.FS4):
  352.  
  353. 80h       " Whether - "
  354. 81h       " OBSERVATION "
  355. 82h       " XX:00 ZULU " (where XX is replaced by the current hour time)
  356. 83h       "" (empty string)
  357. 84h       " TEMPERATURE 25 - "
  358. 85h       " INFORMATION "86h       " LANDING AND DEPARTING RUNWAY XX - " (where XX is replaced by the
  359.           runway number given at offset 5)
  360. 87h       " ADVISE CONTROLLER "
  361. 88h       " ALTIMETER 29.95 - "
  362. 89h       " VISIBILITY 10 - "
  363. 8Ah       " WIND XXX at YY - " (where XXX and YY are replaced by wind
  364.           direction and speed defined by the wind menu or generated by the
  365.           weather generator; if both are off, this character is ignored)8Bh       " MEASURED CEILING 00600 OVERCAST "
  366. 8Ch       "" (empty string)
  367. 8Dh       "" (empty string)
  368. 8Eh       "Microsoft Flight Simulator"
  369. 8Fh       " requesting "
  370. 90h       "clearance "
  371. 91h       ", your are cleared "
  372. 92h       "... "93h       "7777 "
  373.  
  374. -- 1Fh ------DS----- Branch (3 bytes)
  375.  
  376. 1         2    byte offset
  377.  
  378. A group of 1F records is generally preceded by a 20h record.
  379. -- 20h ------DS----- Jump if var between (9 bytes)
  380.  
  381. 1         2    byte offset
  382. 3         2    address of variable
  383. 5         2    value1
  384. 7         2    value2
  385.  
  386. This record jumps over the given amount of bytes, if variable at the givenaddress tests some way in relation to value1 and value2.  value2 is often
  387. 7FFFh and the test can be: "branch if var is between value1 and value2".
  388.  
  389. -- 21h ------------- Check 2 vars for range (15 bytes)
  390.  
  391. 1         2    byte offset
  392. 3         2    var1 address
  393. 5         2    var1 min value7         2    var1 max value
  394. 9         2    var2 address
  395. 11        2    var2 min value
  396. 13        2    var2 max offset
  397.  
  398. This record, as well as the following, is either:
  399.  
  400. ∙ oriented toward the display engine and skips over (or steps through) agroup of records when the two given variables are outside or inside the given
  401. ranges or
  402. ∙ oriented toward the flight simulator engine and performs (or doesn't
  403. perform) some task when...
  404.  
  405. The record has been found, among other, in fuel boxes (which are aways
  406. displayed), where variables are 029Ch and 02A0h and ranges cover the fuel box
  407. surface; one may speculate that these variables, during the simulation, holdthe plane E and N coordinates (029Eh containing the altitude) and that
  408. refueling occurs when the plane is inside the fuel box surface.
  409.  
  410. This record is widely used in F1, where var1 is often equal to var2.
  411.  
  412. -- 22h ------------- Check 3 vars for range (21 bytes)
  413.  
  414. 1         2    byte offset3         2    var1 address
  415. 5         2    var1 min value
  416. 7         2    var1 max value
  417. 9         2    var2 address
  418. 11        2    var2 min value
  419. 13        2    var2 max offset
  420. 15        2    var3 address
  421. 17        2    var3 min value19        2    var3 max offset
  422.  
  423. This record is similar to the previous, but involves 3 variables.
  424.  
  425. It has been found in mountain definitions, where vars are 029Ch, 029Eh, 02A0h
  426. and ranges include the mountain volume.
  427.  
  428. -- 23h ------DS----- Jump if var not equal (7 bytes)
  429. 1         2    byte offset
  430. 3         2    var address
  431. 5         2    value
  432.  
  433. This record jumps if the given var is not equal to the given value.
  434.  
  435. -- 24h ------------- Reference point (14 bytes)
  436. 1         1    always 04h ??
  437. 2         4    E coord. (fract. FSu)
  438. 6         4    AGL alt. (fract. FSu)
  439. 10        4    N coord. (fract. FSu)
  440.  
  441. A reference point record is used within the definitions of some kinds of
  442. object to define a point in 3D, near the center of the object; other pointsof the object are then defined relatively to this point.
  443.  
  444. -- 25h ------DS----- Set variable (5 bytes)
  445.  
  446. 1         2    variable address
  447. 3         2    new variable value
  448.  
  449. This record sets the given variable to the given value.
  450. -- 28 -------------- ?? record (8 bytes)
  451.  
  452. 1         1    record sub-code?? (always 36h in .SC1)
  453. 2         2    byte offset ?
  454. 4         2    var address ?
  455. 6         2    value ?
  456. Used in suspended bridges, cars and fuel boxes.  Attested in F1.
  457.  
  458. -- 29h ------------- Close path (1 byte)
  459.  
  460. This record, made of the single byte 29h, is used to close a path being drawn
  461. with 40h and 41h records.  A line is drawn from the current point to the
  462. starting point of the last executed 41h record.  If the surface colour
  463. variable (02E2h) has been set, the path is filled with that colour.
  464. It is not clear how the display engine is able to detect when the colour var
  465. has not been set (var 02E2h will always contain some value), maybe the line
  466. colour record (line drawing is the only occasion when surface filling is not
  467. required) sets the colour var to a null (0Eh ?) or invalid colour code.
  468.  
  469. -- 2Ah ------DS----- Two delta points (14 bytes) =SEE=
  470. 1         2    P1 E coord. (delta FSu)
  471. 3         2    P1 A coord. (delta FSu)
  472. 5         2    P1 N coord. (delta FSu)
  473. 7         2    P2 E coord. (delta FSu)
  474. 9         2    P2 A coord. (delta FSu)
  475. 11        2    P2 N coord. (delta FSu)
  476. 13        1    ??
  477. -- 2Fh ------------- Path list begin (1 byte)
  478.  
  479. This record, made of the single byte 2Fh, is used to start a path.  Path are
  480. used to draw lines and polygon perimeters.
  481.  
  482. The path list describes a path made of straight lines connecting points. Each
  483. path description begins with the single byte code 2Fh.  Then, a move record
  484. defines the first path point and other draw or move records define the otherpoints.
  485.  
  486. Line paths can contain any combination of move and draw operations to
  487. describe interrupted lines. Polygon perimeters have a move to the first point
  488. followed by draws to following points.
  489.  
  490. Paths can be 'closed' by a single byte record 29h which draws a line from the
  491. current point to the starting point of last move record.  Polygon perimetersMUST be closed.
  492.  
  493. -- 30h ------------- ?? (8 bytes) =DEF=
  494.  
  495. -- 31h ------------- 3D-point (8 bytes)
  496.  
  497. 1         1    point number (for mountains, peaks are numbered from 01h to
  498.                0Fh, base points from 21h inward)2         2    E coord of point (delta FSu)
  499. 4         2    Altitude in m above ground level
  500. 6         2    N coord of point (delta FSu)
  501.  
  502. This record is used in mountain description to set mountain vertices.
  503.  
  504. -- 32h ------DS----- Move to 3D point (2 bytes) =SEE=
  505. 1         1    point number
  506.  
  507. Moves the pen (without drawing) to the point.  Point numbers have been set by
  508. a previous 31h record.
  509.  
  510. -- 33h ------DS----- Draw to 3D point (2 bytes) =SEE=
  511.  
  512. 1         1    point number
  513. Draws to the point.  Point numbers have been set by a previous 31h record.
  514.  
  515. -- 35h ------DS----- ?? (2 bytes) =SEE=
  516.  
  517. -- 3Eh ------------- Area (9 bytes)
  518.  
  519. 1         2    byte offset: the total length in bytes of the following object               definition (this record included)
  520. 3         2    N coord. (int FSu)
  521. 5         2    E coord. (int FSu)
  522. 7         2    area radius (int FSu)
  523.  
  524. An area record starts the representation of each scenery object, gives the
  525. total length of the object and defines the area (usually centered near the
  526. object center) within which the object is visible.
  527. -- 40/C0h ---------- Move to 2D point (5 bytes)
  528. -- 41h ------------- Draw to 2D point (5 bytes)
  529.  
  530. 1         2    E coord. of the point (delta FSu)
  531. 3         2    N coord. of the point (delta FSu)
  532.  
  533. Move and draw records are used to define points of lines and of polygonperimeters.  A move record moves to the point given in the record without
  534. drawing anything, a draw record draws a line segment or a polygon boundary
  535. from the previous point to the given point.  Move record code can be either
  536. 40h or C0h, without any visible difference.
  537.  
  538. All coords are delta coords and are relative to a previously given ref. point
  539. record.
  540. -- 43h ------DS----- ?? (1 byte)
  541.  
  542. -- 45h xxxx -------- Thermal generator (xxxx bytes)
  543.  
  544. 1         2    record length (0025h)
  545. 3         4    E coord of generator center (fract FSu)
  546. 7         4    altitude AGL of generator center ?
  547. 11        4    N coord of generator center (fract FSu)15        2    orientation
  548. 17        1    ???
  549. 18        2    generator width (in m)
  550. 20        2    ???
  551. 22        2    thermal effect height (in feet)
  552. 24        2    ???
  553. 26        2    generator length (in m)
  554. 28        9    ???
  555. This record has been found only in thermal generators.
  556.  
  557. -- 4Ch ------DS----- ?? (2 bytes) =SEE=
  558.  
  559. -- 4Dh xxxx--DS----- ?? (xxxx bytes) =SEE=
  560.  
  561. -- 4Eh ------DS----- ?? (4 bytes) =SEE=
  562. -- 4Fh ------------- ILS (15 bytes)
  563.  
  564. 1         2    frequency; BCD coded (ex.: 109.15 MHz -> 15h 09h)
  565. 3         4    E coord. (fract. FSu)
  566. 7         4    N coord. (fract. FSu)
  567. 11        2    Approach course in 1/3° (0 -> 0, 359 -> 0435h)
  568. 13        3    Glide slope in 1/9100 (0 -> 0, 7.20 -> FFFFh)
  569. -- 50/D0h ---------- Runway (35 bytes)
  570.  
  571. See below under runway descriptions for details.
  572.  
  573. -- 51h ------------- Side list end (used in mountains, 1 byte)
  574.  
  575. -- 52h ------DS----- ?? (2 bytes) =SEE=
  576. -- 53h ------------- Building (variable)
  577.  
  578. The building record defines the aspect of a building, its length and
  579. structure varies according to the building type. Here a summary is given, see
  580. below, under building descriptions, for details.
  581.  
  582. 2nd byte                 building type and length
  583. 01             Rectangular building record (18 [flat] and 19 [peaked] bytes)
  584. 02             L building record (24 [flat] and 27 [peaked] bytes)
  585. 03             T building record (28 [flat] and 32 [peaked] bytes)
  586. 04             U building record (28 [flat] and 33 [peaked] bytes)
  587. 05             H building record (34 [flat] and 41 [peaked] bytes)
  588. 06             Reversed L build. record (24 [flat] and 27 [peaked] bytes)
  589. 07             Control tower record (20 bytes)29             Tower record (6 bytes)
  590. 33             Suspended bridge record (8 bytes)
  591. 34             Bridge record (8 bytes)
  592. 3D             Timing gate record (17 bytes)
  593. 42             Coniferous tree record (7 bytes)
  594. 43             Deciduous tree record (7 bytes)
  595. 47             Auto record (3 bytes)
  596. 4C             Multi-sided building record (13 bytes)
  597. -- 58h ------DS----- 3D text (43 bytes) =SEE=
  598.  
  599. 1         7    ???
  600. 8         2    text size
  601. 10        32   text, 0-terminated
  602. 42        1    always 17h ?? (in that case, it could be another occurrence of
  603.                the 17h record)
  604. -- 5Ah ------DS----- 3D-triangle (10 bytes)
  605.  
  606. 1         2    E component of the "triangle vector" (see below)
  607. 3         2    A component
  608. 5         2    N component
  609. 7         3    numbers of the 3 points, listed in anti-clockwise order
  610.                looking to the triangle from outside
  611. This record is used in mountains and is probably used to speed up the hidden
  612. surface removing process.  The "triangle vector" is the cross product of the
  613. vectors for the P2-P1 and the P3-P1 edges of the tiangle, the cross product
  614. is then scaled so that no coord value is > 16383.  Point numbers at offset 7-
  615. 9 correspond to mountain vertices defines in a previous list of 3D points
  616. (list of 31h records).
  617. -- 6Fh ------DS----- ?? (11 bytes) =SEE=
  618.  
  619. -- 79h ------------- Linked list end (1 byte)
  620.  
  621. Marks end of linked list. It is used to mark the end of .SC1 file sections.
  622.  
  623.  
  624. ====================
  625.           OBJECT DETAILED DESCRIPTIONS
  626.  
  627. The following section contains a detailed description of all the object found
  628. in standard .SC1 files, with examples of decoding.  With the exception of ATC
  629. messages, SEE extensions are not included.
  630.  
  631. ====================
  632. NAV AIDS
  633.  
  634. Like all .SC1 object, navaids begin with an area record; NDB, VOR, and ILS
  635. add a specific record (05h, 1Dh, 4Fh, resp.); Markers add a 25h record
  636. setting var 02F6h (inner marker), 02F8h (outer marker) or 02FAh (middle
  637. marker) to 0001.
  638. Adding the 9 bytes of the area record, the total length of each kind of Nav
  639. aids is (in parenthesis, the area radius set by ASD):
  640.  
  641. NDB       20 bytes       (500 FSu = 128 Km = 69 NM)
  642. VOR       20 bytes       (500 FSu = 128 Km = 69 NM)
  643. ILS       24 bytes       (250 FSu = 64 Km = 34.6 NM)
  644. OM        14 bytes       (2 FSu = 512 m)
  645. MM        14 bytes       (2 FSu = 512 m)IM        14 bytes       (1 FSu = 256 m)
  646.  
  647. Example:
  648.  
  649. 3E 18 00 92 03 8C 04 FA 00 4F 25 09 00 06 8C 04 00 00 92 03 2C 01 FF 6A
  650.  
  651. is interpreted as:
  652. 3Eh       Area record
  653.   0018h        object is 24 bytes long
  654.   0392h        N coord of visib. area is [0392h =] 914 + 16384 = 17298
  655.   048Ch        E coord of visib. area is [048Ch =] 1164 + 16384 = 17548
  656.   00FA         area radius is [FAh =] 500 FSu
  657. 4Fh       ILS record
  658.   0925h        frequency is 109.25 MHz
  659.   048C0600h    E coord is [0485.06h =] 1164+6/256 + 16384 = 17548.0234  03920000h    N coord is [0392.00h =]  914+0/256 + 16384 = 17298.0000
  660.   012Ch        approach course is [012Ch =] 300 / 3 = 100°
  661.   6AFFh        glide slope is [6AFFh = ] 27391 / 9100 = 3.01
  662.  
  663. ====================
  664.  
  665. ATC MESSAGES
  666. ASD cannot add ATC messages to sceneries. However, messages added to .SC1
  667. files with other programs (or manually!) are correctly played by FS4 and do
  668. not interfere with ASD ability to manipulate the modified .SC1.
  669. The following structure has been determined from SEE4-modified sceneries.
  670.  
  671. ATC messages are made by:
  672. ∙ an area record
  673. ∙ a 5-byte jump record with fixed contents: 0Bh 0005h 41h 43h (where 4341h isprobably an ID meaning "ATC")
  674. ∙ an ATC message record (1Eh)
  675.  
  676. ====================
  677.  
  678. POLYGONS
  679.  
  680. Polygon descriptions are made of an area record, a ref. point record, asurface colour record and a point list.  As for any object of variable size,
  681. area radius is not fixed, like in nav aids, but depends on the polygon size.
  682.  
  683. Triangles are special, because, after the polygon proper, they add a 3-point
  684. line corresponding to two of the three sides of the triangle; this line has
  685. the same colour of the triangle and cannot be seen.
  686.  
  687. Example:
  688. 3E 3E 00 92 03 8D 04 03 00 24 04 00 4D 8D 04 00
  689. 0A 00 00 00 B9 92 03 25 E2 02 99 99 2F 40 F2 FF
  690. 08 00 41 0D 00 0B 00 41 0F 00 F6 FF 29 12 09 40
  691. F2 FF 08 00 41 0D 00 0B 00 41 0F 00 F6 FF
  692.  
  693. is interpreted as:
  694. 3Eh       Area record
  695.   003Eh        object is 62 bytes long
  696.   0392h        N coord of visib. area is 17298
  697.   048Dh        E coord of visib. area is 17549
  698.   0003         area radius is 3 FSu
  699. 24h 04h   Ref. point record
  700.   048D4D00h    E coord is [048D.4Dh =] 1165+77/256 + 16384 = 17549.0273
  701.   00000A00h    altitude above ground level is [00000Ah =] 10 m  0392B900h    N coord is [0392.B9h =] 914+185/256 + 16384 = 17298.7227
  702. 25h       Set variable record
  703.   02E2h        variable at 02E2 (surface colour)
  704.   9999h        set to colour 9 (yellow)
  705. 2Fh       Point list begin
  706. 40h       Move record
  707.   FFF2h        E coord of P1: [FF.F2h =] -14/256 + 17549.0273 = 17548.9726
  708.   0008h        N coord of P1: [00.08h =]   8/256 + 17298.7227 = 17298.754041h       Draw record
  709.   000Dh        E coord of P2: [00.0Dh =]  13/256 + 17549.0273 = 17549.0781
  710.   000Bh        N coord of P2: [00.0Bh =]  11/256 + 17298.7227 = 17298.7657
  711. 41h       Draw record
  712.   000Fh        E coord of P3: [00.0Fh =]  15/256 + 17549.0273 = 17549.0859
  713.   FFF6h        N coord of P3: [FF.F6h =] -10/256 + 17298.7227 = 17298.6836
  714. 29h       Close and fill (polygons with 4 or more points, would stop there)
  715. 12h 09h   Line colour is 9 (yellow)40h FFF2h 0008h same move record as above
  716. 41h 000Dh 000Bh same draw record as above
  717. 41h 000Fh FFF6h same draw record as above
  718.  
  719. ====================
  720.  
  721. RIVERS
  722. Even if they are created in ASD stretching and bending rectangular strips of
  723. colour, rivers are actually memorized in scenery files as polygons, and
  724. follow the same format described in the previous section. The reason for
  725. keeping them in a specific section resides probably in the order in which
  726. scenery object are drawn.
  727.  
  728. Rivers can also contain skips: in this case, the river description contains a
  729. single area record and a single ref. point record followed by a surfacecolour record and a point list for each polygon created by skipping.
  730.  
  731. ====================
  732.  
  733. ROADS
  734.  
  735. Roads also are memorized as polygons, and follow the polygon format. For
  736. skippings, the same observation made about rivers, holds also for roads.
  737. Country roads and city streets require no observations.
  738.  
  739. 4-lane roads contain, after the point list describing the road perimeter, a
  740. line colour record and a line point list describing the road middle line.
  741.  
  742. Divided highways, after the area and ref. point records, contain a single
  743. surface colour record (25h) with two polygon point lists to describe the tworoad ways, then a line colour record, a conditional jump record (23h) on var
  744. 028Ch value and another line colour record to change colour line according to
  745. time, and a line point list with 4 jumps to describe the 4 borders of the
  746. ways.
  747.  
  748. ====================
  749.  
  750. LINES
  751. Line descriptions are made of an area record, a ref. point record, a line
  752. colour record and a line point list.  If the line contains skips, a new line
  753. colour record and a new line point list are generated for each line section.
  754.  
  755. ====================
  756.  
  757. RUNWAYS
  758. Runway descriptions are made of 2 area records referring to the same point
  759. (one for the distance at which the runway is sketchily visible, the other for
  760. the distance at which it is fully visible), a 25h record to set area altitude
  761. and the specialized runway record:
  762.  
  763. Runway record - code: 50h/D0h  length: 35 bytes
  764. 0         1    50h or D0h: record code
  765. 1         4    E coord of center (fract. FSu)
  766. 5         4    Altitude (fract. FSu)
  767. 9         4    N coord of center (fract. FSu)
  768. 13        1    Design elements (bit is 1 if the element is present):
  769.                bit       7: always 1
  770.                          6: always 1
  771.                          5: Numbers                         4: Dashes
  772.                          3: Fixed distance markers
  773.                          2: Touchdown markers
  774.                          1: Threshold markers
  775.                          0: Edges
  776. 14        1    Runway colour (repeated in each nibble)
  777. 15        1    Edge colour               (")
  778. 16        1    Threshold mkr colour      (")17        1    Touchdown mkr colour      (")
  779. 18        1    Fixed distance mkr colour (")
  780. 19        1    Dash colour               (")
  781. 20        1    Number colour             (")
  782. 21        1    Runway number (down side) as hex number
  783. 22        1    Designator:
  784.                          0: none
  785.                          1: LEFT/RIGHT                         2: RIGHT/LEFT
  786.                          3: CENTER/CENTER
  787. 23        1    Down side lights:
  788.                bit       0: End light
  789.                          1: always 0?
  790.                          2: REIL
  791.                          3: VASI
  792.                high nibble value:                         0: none
  793.                          1: MASLR
  794.                          2: MASLR with strobes
  795.                          3: SSALR
  796.                          4: SSALR with strobes
  797.                          5: MALSF
  798.                          6: MALSF with strobes
  799.                          7: SSALF                         8: SSALF with strobes
  800.                          9: ALSF-I
  801.                          A: ALSF-II
  802. 24        2    Down side VASI slope in 1/10°
  803. 26        1    Up side lights (as in byte 23)
  804. 27        2    Up side VASI slope in 1/10°
  805. 29        2    Up side direction in 1/182.04°
  806. 31        2    Runway width in m33        2    Runway length in m
  807.  
  808. Note: up side refers to the runway end located up when placing it, down side
  809. is the other end.
  810.  
  811. Example:
  812.  
  813. 3E 3A 00 2B F9 2D 05 32 00 3E 0E 00 2B F9 2D 0515 00 25 EF 02 0F 00 D0 00 4C 2D 05 00 00 00 00
  814. 00 21 2B F9 FF 00 88 DD 88 99 FF FF 04 00 01 1C
  815. 00 39 1E 00 5C 15 2D 00 52 08
  816.  
  817. is interpreted as:
  818.  
  819. 3Eh       Area record
  820.   003Ah        object is 58 bytes long  F92Bh        N coord is [F92Bh =] 63787 - 49152 = 14635
  821.   052Dh        E coord is [052Dh =]  1325 + 16384 = 17709
  822.   0032h        area radius is 50 FSu (12.8 Km)
  823. 3Eh       Area record
  824.   000Eh        16 bytes
  825.   F92Bh        N coord is 14635 again
  826.   052Dh        E coord is 17709 again
  827.   0015h        inner area radius is 21 FSu (5.4 Km)25h       Set var
  828.   02EFh        at 02EFh (area altitude)
  829.   000Fh        to 15 m above sea level
  830. D0h       Runway record
  831.   052D4C00h    E coord. of runway is 17709.2969
  832.   00000000h    Altitude is 0
  833.   F92B2100h    N coord. of runway is 14635.8711
  834.   FFh          runway has all design elements  00h          runway colour is Black
  835.   88h          edge colour is Brown
  836.   DDh          threshold mkr colour is Gold
  837.   88h          touchdown mkr colour is Brown
  838.   99h          fix. dist.mkr colour is Yellow
  839.   FFh          dash colour is White
  840.   FFh          number colour is White
  841.   04h          runway number is 4  00h          no designator
  842.   01h          down side has end lights
  843.   001Ch        down side VASI slope is [1Ch =] 28 / 10 = 2.8° *
  844.   39h          up side has VASI and end light (9) of type SSALR (3)
  845.   001Eh        up side VASI slope is [1Eh =] 30 / 10 = 3.0°
  846.   155Ch        runway direction is [155Ch =] 5468 / 182.04 = 30.04°
  847.   002Dh        runway is [002Dh =] 45 meter wide
  848.   0852h        runway is [0852h =] 2130 meter long
  849. Note: down side VASI slope is actually undefined because down side has no
  850. VASI.
  851.  
  852. ====================
  853.  
  854. MOUNTAINS
  855. Mountains are among the most complex ASD objects.  These are the records used
  856. to define a mountain:
  857.  
  858. ∙ an area record,
  859. ∙ a jump over jump record (0Eh) (variable structure construct)
  860. ∙ a 3-byte jump record (0Bh) spanning the entire mountain definition
  861. ∙ a ref. point record.
  862. Then, for each peak and each point of the base, there is:
  863. ∙ a 3D-point record (31h)
  864.  
  865. ∙ a 25h 031Eh 0000h constant record
  866. ∙ a 22h record with a byte offset of 001Ah and checking values of vars at
  867. 029Ch (E coord.), 029Eh (A coord.), and 02A0h (N coord.)
  868. ∙ a 25h 031Eh 0001h constant record
  869. Then, for each side of the mountain, two records are given:
  870. ∙ an area colour record (25h 02E2h xxxxh)
  871. ∙ a 3D-triangle record (5Ah)
  872.  
  873. The side list is terminated by the single byte record 51h, and the entire
  874. object by the single byte record 19h
  875.  
  876. Example:This example describes a square mountain, with sides 2 FSu long and parallel
  877. to the coordinate axes.
  878.  
  879. 3E 00A2 0393 048C 0040   Center: 17299, 17548; radius: 64 FSu
  880. 8E 0006                  Jump over the next 0Bh record (var. struct. constr.)
  881. 0B 0096                  Jump over [0096h =] 150 bytes
  882. 24 04 048C0000 00000000 03930000
  883.                          Ref. point: 17548 E, 0 AGL, 17299 N31 01 0080 0098 0080     1st peak: +0.5 E,+152 m, +0.5 N from ref. point
  884. 31 21 FF00 0000 0100     1st point:-1.0 E, + 0 m, +1.0 N from ref. point
  885. 31 22 0100 0000 0100     2nd point:+1.0 E, + 0 m, +1.0 N from ref. point
  886. 31 23 0100 0000 FF00     3rd point:+1.0 E, + 0 m, -1.0 N from ref. point
  887. 31 24 FF00 0000 FF00     4th point:-1.0 E, + 0 m, -1.0 N from ref. point
  888. 25 031E 0000             Set var at 031Eh to 0 (fixed)
  889. 22 001A                  3-var record: byte offset 26
  890.   029C FF00 0100         var 029Ch (E range): -1.0 to +1.0 around ref. point  029E 0000 0198         var 029Eh (A range): 0 to [0198h - 0100h =] 152 m
  891.   02A0 FF00 0100         var 02A0h (N range): -1.0 to +1.0 around ref. point
  892. 25 031E 0001             set var at 031Eh to 1 (fixed)
  893. 25 02E2 5555             Surface colour: Light Grey
  894. 5A 1300 D000 0000 01 21 24    Triangle thru 1st peak, 1st and 4th points
  895. 25 02E2 8888             Surface colour: Brown
  896. 5A 0000 D000 1300 01 24 23    Triangle thru 1st peak, 4th and 3rd points
  897. 25 02E2 AAAA             Surface colour: Dark Grey5A DA00 E000 0000 01 23 22    Triangle thru 1st peak, 3rd and 2nd points
  898. 25 02E2 5555             Surface colour: Light Grey
  899. 5A 0000 E000 DA00 01 22 21    Triangle thru 1st peak, 2nd and 1st points
  900. 51                       End of triangle list
  901. 19                       End of variable structure
  902.  
  903. ====================
  904. TIMING GATES
  905.  
  906. Timing gate description is not fully deciphered. It is made of:
  907. ∙ an area record
  908. ∙ a jump over jump record (variable structure construct)
  909. ∙ a jump record
  910. ∙ a reference point record
  911. ∙ an orientation record∙ a single byte record (17h)
  912. ∙ a specialized timing gate record
  913. ∙ an end of structure record.
  914.  
  915. -- 53h 3Dh --------- Timing gate (17 bytes)
  916.  
  917. 0         0    53h: object record code
  918. 1         1    3Dh: timing gate sub-code2         2    gate width in m
  919. 4         2    gate height in m
  920. 6         1    front colour (code in both nibbles)
  921. 7         1    back colour (code in both nibbles)
  922. 8         2    always 0 ??
  923. 10        1    gate number from 0 onward; last gate number has msb set
  924. 11        2    ??
  925. 13        2    ??15        2    ??
  926.  
  927. Note: the last 3 field values vary from gate to gate of the same amounts of
  928. which E coord., alt. and N coord. vary; they are perhaps connected with the
  929. distance from gate to gate.
  930.  
  931. ====================
  932. BUILDINGS
  933.  
  934. All real buildings share the same structure (poles, bridges, trees, autos,
  935. fuel boxes and thermal generators depart somewhat from this structure):
  936.  
  937. ∙ an area record
  938. ∙ a jump over jump record (0Eh) (variable structure construct)
  939. ∙ a 5-byte jump record (0Bh) spanning the entire object definition; the last  word contains a value related to building type and detailed below
  940. ∙ a reference point record
  941. ∙ an orientation record
  942. ∙ a first end of structure record (19h single byte)
  943. ∙ a 53h variable record depending on the object
  944. ∙ a second end of structure record.
  945.  
  946. For buildings, the 53h record contains:∙ the record code 53h in the 1st byte
  947. ∙ a sub-code related to the building type in the 2nd byte
  948. ∙ a series of 2-bytes fields defining wall distances from ref. point (first
  949.   horizontal positions from left [negative] to right [positive], then
  950.   vertical positions from top [positive] to bottom [negative])
  951. ∙ a 2-bytes field with base height
  952. ∙ a single byte field with peak height (0 for flat roofs)
  953. ∙ a series of single byte fields with wall colours and roof pitches colours  (just one if the roof is flat).
  954.  
  955. All distances are in meters, and colour codes are repeated in both nibbles.
  956.  
  957. In the following sketches, for each kind of building, code and sub-code of
  958. 53h record as well as the build. type in the last word of the jump record are
  959. given; numbers and letters show the order in which wall positions and colour
  960. codes respectively appear within the 53h record.
  961. Rectangular building (53h 01h)
  962.   flat roof (type 0003h)     peaked roof (type 0005h)
  963.  
  964.   1           2              1           2
  965.   │     a     │              │     a     │
  966.   ┌───────────┐─ 3           ┌───────────┐─ 3
  967.   │           │              │     f     │d │     e     │ b          d ├───────────┤ b
  968.   │           │              │     g     │
  969.   └───────────┘─ 4           └───────────┘─ 4
  970.         c                          c
  971.  
  972. L building (53h 02h)
  973.   flat roof (type 0007h)     peaked roof (type 0009h)
  974.   1       2      3             1       2      3
  975.   │   a   │      │             │   a   │      │
  976.   ┌───────┐       ─ 4          ┌───┬───┐       ─ 4
  977.   │       │b                   │   │   │ b
  978.   │       │   c                │   │ h │   c
  979.   │       └──────┐─ 5          │ g │  /└──────┐─ 5
  980. f │      g       │           f │   │/    i    │
  981.   │              │ d           │  /└──────────┤ d  │              │             │/      l      │
  982.   └──────────────┘─ 6          └──────────────┘─ 6
  983.          e                            e
  984.  
  985. Reversed L building (53h 06h)
  986.   flat roof (type 000Bh)     peaked roof (type 000Dh)
  987.  
  988.   1       2      3             1       2       3  │       │   c  │             │       │   c   │
  989.           ┌──────┐─ 4                  ┌───┬───┐─ 4
  990.         b │      │                   b │   │   │
  991.       a   │      │                 a   │ h │   │
  992.   ┌───────┘      │─ 5          ┌───────┘\  │ g │─ 5
  993.   │         g    │ d           │     i    \│   │ d
  994. f │              │           f ├───────────┘\  │
  995.   │              │             │       j      \│  └──────────────┘─ 6          └───────────────┘─ 6
  996.          e                            e
  997.  
  998. T building (53h 03h)
  999.   flat roof (type 000Fh)          peaked roof (type 0011h)
  1000.  
  1001.   1       2       3       4       1       2       3       4
  1002.   │       │   a   │       │       │       │   a   │       │  ┌───────────────────────┐─ 5    ┌───────────────────────┐─ 5
  1003.   │                       │       │           i           │
  1004. h │                       │ b   h ├───────────┬───────────┤ b
  1005.   │           i           │       │     j    /│\    m     │
  1006.   └───────┐       ┌───────┘─ 6    └───────┐/  │  \┌───────┘─ 6
  1007.       g   │       │    c              g   │   │   │    c
  1008.         f │       │ d                   f │ k │ l │ d
  1009.           │       │                       │   │   │          └───────┘        ─ 7            └───┴───┘        ─ 7
  1010.               e                               e
  1011.  
  1012. U building (53h 04h)
  1013.   flat roof (type 0013h)          peaked roof (type 0015h)
  1014.  
  1015.   1       2       3       4       1       2       3       4
  1016.   │   a   │       │   e   │       │   a   │       │   e   │  ┌───────┐       ┌───────┐─ 5    ┌───┬───┐       ┌───┬───┐─ 5
  1017.   │       │b     d│       │       │   │   │b     d│   │   │
  1018.   │       │   c   │       │       │   │ j │   c   │ m │   │
  1019. h │       └───────┘       │─ 6  h │ i │  /└───────┘\  │ n │─ 6
  1020.   │                       │ f     │   │/      k      \│   │ f
  1021.   │           i           │       │  /└───────────────┘\  │
  1022.   │                       │       │/          l          \│
  1023.   └───────────────────────┘─ 7    └───────────────────────┘─ 7              g                               g
  1024.  
  1025. H building (53h 05h)
  1026.   flat roof (type 0017h)          peaked roof (type 0019h)
  1027.  
  1028.   1       2       3       4       1       2       3       4
  1029.   │   a   │       │   e   │       │   a   │       │   e   │
  1030.   ┌───────┐       ┌───────┐─ 5    ┌───┬───┐       ┌───┬───┐─ 5  │       │b     d│       │       │   │   │b     d│   │   │
  1031.   │       │   c   │       │       │   │ n │   c   │ r │   │
  1032.   │       └───────┘       │─ 6    │   │  /└───────┘\  │   │─ 6
  1033.   │                       │       │   │/      p      \│   │
  1034. l │           m           │ f   l │ m ├───────────────┤ t │ f
  1035.   │                       │       │   │\      q      /│   │
  1036.   │       ┌───────┐       │─ 7    │   │  \┌───────┐/  │   │─ 7
  1037.   │       │   i   │       │       │   │ o │   i   │ s │   │  │       │j     h│       │       │   │   │j     h│   │   │
  1038.   └───────┘       └───────┘─ 8    └───┴───┘       └───┴───┘─ 8
  1039.       k               g              k                g
  1040.  
  1041. Example of a peaked L building:
  1042.  
  1043. 3E 0045 0391 048C 0003        Area record
  1044. 8E 0008 0B 0039 0009          Jump over next jump record0B 0039 0009                  Jump over 57 bytes, object type is 9
  1045. 24 04 048C0A00 00000000 03918700
  1046.                               Ref. point record (center of the object)
  1047. 16 0000 0000 FC6E 000A        Orient. record: 0° pitch, 0° bank,
  1048.                               [FC6E =] -914 / 182.04 = -5.02°
  1049. 19
  1050. 53 02                         L building record
  1051.   FFF6 FFFF 000A              Ascisses of walls are -10, -1, 10  0007 0001 FFF9              Ordinates of walls are 7, 1, -7
  1052.   0004 02                     base heigh is 4 m, peak height is 2 m
  1053.   66 88 99 66 88 99           wall colours are L.Blue, Brown, Yellow, L.Blue,
  1054.                               Brown, Yellow
  1055.   55 AA 55 AA                 roof colours are L.Grey, D.Grey, L.Grey, D.Grey
  1056. 19
  1057.  
  1058. Multi-sided building (53h 4Ch)
  1059.   flat roof (type 001Bh) and peaked roof (type 001D) have the same contents:
  1060.  
  1061. 0         1    53h: record code
  1062. 1         1    4Ch: record sub-code
  1063. 2         1    number of sides
  1064. 3         2    length in m
  1065. 5         2    width in m7         2    height in m
  1066. 9         2    two alternating colours for sides
  1067. 11        2    two alternating colours for roof pitches
  1068. 12        1    peak height in m
  1069.  
  1070. Control tower (type 001Fh; codes 53h 07h)
  1071.  
  1072. 0         1    53h: record code1         1    07h: record sub-code
  1073. 2         8    four wall positions as for rectangular buildings
  1074. 10        2    base height
  1075. 12        2    always 0Ah ?? (irrelevant)
  1076. 14        4    four side colours as for rectangular buildings
  1077. 18        1    roof colour
  1078. 19        1    always 00h ?? (irrelevant)
  1079. Bridge (type 0025h; codes 53h 34h):
  1080.  
  1081. 0         1    53h: record code
  1082. 1         1    34h: record sub-code
  1083. 2         2    length
  1084. 4         2    width
  1085. 6         1    suspension colour (0 for non-suspended bridge)
  1086. 7         1    bridge colour
  1087.  
  1088. The following 4 object types lack the orientation record.
  1089.  
  1090. Tower (type 0020h; codes 53h 29h) and wind sock (type 0022h; codes 53h 2Eh)
  1091. have the same structure:
  1092.  
  1093. 0         1    53h: record code1         2    29h / 2Eh: record sub-code
  1094. 2         1    always 0 ?? (irrelevant)
  1095. 3         2    height
  1096.  
  1097. Coniferous (type 0028h; codes 53h 42h) and deciduous tree (type 002Bh; codes
  1098. 53h 43h) have the same structure:
  1099.  
  1100. 0         1    53h: record code1         1    42h / 43h: record sub-code
  1101. 2         1    total height
  1102. 3         1    width
  1103. 4         1    trunk height
  1104. 5         1    leave colour
  1105. 6         1    trunk colour
  1106.  
  1107. Suspended bridges (type 0027h; codes 53h 33h) and autos (type 002Dh; codes53h 47h) add a 28h 36h record right before the 53h record.
  1108.  
  1109. Suspended bridges have the same 53h record as standard bridges (of course,
  1110. sub-code is 33h instead of 34h).
  1111.  
  1112. Autos have a 3-byte 53h record containing, after code and sub-code, only a
  1113. byte with the auto colour.
  1114. --------------------
  1115.  
  1116. Fuel box (type 002Fh).
  1117.  
  1118. Fuel box descriptions are complex, but the great part is fixed because fuel
  1119. boxes have a fixed size and are always oriented toward the North. Below a
  1120. template is given:
  1121. 3E 0076 xxxx xxxx 0007        Area record (coords may vary, length [118
  1122.                               bytes] and radius [7 FSu=ca 1 NM] are constant)
  1123. 8E 0008                       Jump over next jump (var. struct. construct)
  1124. 0B 006A 002F                  Jump over 106 bytes; object type 2Fh
  1125. 24 02 xxxxxxxx xxxxxxxx xxxxxxxx
  1126.                               Ref. point record (coords and alt. may vary)
  1127. 16 0000 0000 0000 000A        Orientation is always flat and North
  1128. 1928 36 004C 034E FFFF          other 004Ch bytes of description
  1129. 12 99                         yellow line
  1130. 40 FF80 FF44                  the "F", described with normal lines
  1131. 41 FF80 0098                      leg
  1132. 41 0080 0098                      upper arm
  1133. 40 007A FFF4                      jump to
  1134. 41 FF80 FFF4                      lower arm
  1135. 40 FEFB FEFB                  the box41 00F9 FEFB                      lower side
  1136. 41 00F9 0101                      right side
  1137. 41 FEFB 0101                      upper side
  1138. 29                            close the box
  1139. 21 0014                       2-var record: byte offset is 20
  1140.   029C FEFB 00FF                  var 029Ch (E range) from -260 to 255
  1141.   02A0 FEFB 0101                  var 02A0h (N range) from -260 to 257
  1142. 25 0288 0001                  This is a fuel box19                            End of variable structure
  1143.  
  1144. --------------------
  1145.  
  1146. Thermal generator (type 0031h)
  1147.  
  1148. Thermal generators also have a very special description including some
  1149. general records. Again, a template is given.
  1150. 3E 006A xxxx xxxx xxxx        Area record (106 bytes long, coords may vary,
  1151.                               as well as radius, which depend on size)
  1152. 8E 0008                       Jump over next jump record (var. struct. con.)
  1153. 0B 005E 0031                  Jump over 94 bytes; object type is 0031
  1154. 24 04 xxxxxxxx xxxxxxxx xxxxxxxx
  1155.                               Ref. point record
  1156. 16 xxxx xxxx xxxx 000A        Orientation record19
  1157. 25 02E2 xxxx                  Surface colour record
  1158. 2F                            Polygon begin
  1159. 40 xxxx xxxx                  generator area as a polygon
  1160. 41 xxxx xxxx
  1161. 41 xxxx xxxx
  1162. 41 xxxx xxxx
  1163. 29                            close area and fill45 0025                       a 45h record, 0025h bytes long, follow:
  1164.     xxxxxxxx                  E coord of generator center
  1165.     ????????                  ??? (4 bytes)
  1166.     xxxxxxxx                  N coord of generator center
  1167.     xxxx                      orientation
  1168.     ??                        ??? (1 byte)
  1169.     xxxx                      generator width (in m)
  1170.     ????                      ??? (2 bytes)    xxxx                      thermal effect height (in feet)
  1171.     ????                      ??? (2 bytes)
  1172.     xxxx                      generator length
  1173.     ??????????????????        ??? (9 bytes)
  1174.  
  1175. ========================================
  1176.  
  1177.  
  1178.                           DYNAMIC SCENERIES (.DY1)
  1179.  
  1180.  
  1181. GENERAL STRUCTURE
  1182.  
  1183. Dynamic scenery files are made of:
  1184. ∙ a header containing various pointers∙ a pattern definition section containing the definitions of all the patterns
  1185. in the file
  1186. ∙ a pattern code section containing the actual description of the patterns.
  1187.  
  1188. ====================
  1189.  
  1190. HEADER STRUCTURE; length: 43 bytes
  1191. 0         2    file length
  1192. 2         2    0002h (a kind of signature?)
  1193. 4         2    000Ch (= 12; pointer to scenery name)
  1194. 6         2    002Bh (= 43; header length)
  1195. 8         2    number to be assigned to the next pattern that will be defined
  1196. 10        2    pointer to pattern code section
  1197. 12        31   scenery names: up to 30 characters (padded with space, if
  1198.                shorter) plus a 0 ending byte
  1199. ====================
  1200.  
  1201. PATTERN DEFINITION SECTION
  1202.  
  1203. The pattern definition section contains a 48-byte block for each pattern of
  1204. the scenery.
  1205. 0         2    pattern number (see note)
  1206. 2         2    model:    0065h  Cessna R182
  1207.                          0066h  Boeing 747
  1208.                          0067h  Gates Learjet
  1209.                          0068h  F14
  1210.                          0069h  Schweizer SGS
  1211.                          012Dh  Fuel truck
  1212.                          0137h  Red car                         0138h  Blue car
  1213.                          0139h  White car
  1214.                          0191h  Sail boat
  1215.                Any other model code is rendered by ASD as a Cessna R182.
  1216. 4         2    pointer to the corresponding pattern code
  1217. 6         2    length of the corresponding pattern code
  1218. 8         2    number of the pattern after which this pattern will start,
  1219.                zero if patter starts immediately10        1    begin code:
  1220.                          0    immediately
  1221.                          1    after other pattern starts
  1222.                          2    after other pattern takes off
  1223.                          3    after other pattern lands
  1224.                          4    after other pattern parks
  1225. 11        1    status code: 0 - inactive, 1 - active
  1226. 12        1    end action code:                         0    start over
  1227.                          1    park
  1228.                          2    disappear
  1229. 13        1    display before start: 0 - yes, 1 - no (sic!!)
  1230. 14        4    ??? (irrelevant)
  1231. 18        30   pattern name, padded with spaces, no ending zero
  1232.  
  1233. Note: to each new pattern is assigned the number contained at byte 8 of fileheader which is then increased; when a pattern is deleted, its record is
  1234. removed and other patterns are shifted but its number is not made available,
  1235. nor other pattern numbers are modified to fill a possible gap, as a
  1236. consequence patterns can have numbers greater than the total number of
  1237. patterns present in the file.
  1238.  
  1239. ====================
  1240. PATTERN CODE SECTION
  1241.  
  1242. This section contains all the definitions of the scenery patterns, one after
  1243. the other. Pattern definitions are made of 5 kinds of records:
  1244. 00h       Initial record      20 bytes
  1245. FFh       Position record     21 bytes
  1246. 02h       Look record         5 bytes
  1247. 06h       Take off/Land record 2 bytes04h       End of pattern record 1 byte
  1248.  
  1249. -- 00h ------------- Initial record (20 bytes)
  1250.  
  1251. Used to set the initial position of the object at the beginning of the
  1252. pattern.
  1253.  
  1254. 1         4    E coord (fract. FSu; all 4 bytes used)5         4    alt. AGL (fract. FSu; all 4 bytes used)
  1255. 9         4    N coord (fract. FSu; all 4 bytes used)
  1256. 13        2    pitch (noze down is positive, noze up is negative)
  1257. 15        2    bank (left is positive, right is negative)
  1258. 17        2    heading
  1259. 19        1    always 03 ??
  1260.  
  1261. Note: Pitch variation is somewhat special: if the object rotates more than90° up or down, it is reversed up side down and pitch sign is changed!
  1262.  
  1263. -- 02h ------------- Look record (5 bytes)
  1264.  
  1265. Look record defines some visual detail of the object. To my knowledge, a look
  1266. record may have 3 sub-codes, related to 3 visual aspect; patterns always
  1267. begin defining the initial values of these aspects with 3 look records, one
  1268. for each sub-code.
  1269. 1         2    FFFEh:    shadow is visible or not
  1270.                FFFDh:    object is flying or landed
  1271.                FFFBh:    gear is lowered or not
  1272. 3         2    value:    for FFFEh: 1 = shadow on, 0 = shadow off
  1273.                          for FFFDh: 2 = landed, 0 = flying
  1274.                          for FFFBh: 4 = gear down, any other value = up
  1275. Notes: Shadow is switched off by ASD when the object raises above ca. 100 m
  1276. from ground level. Sub-code FFFDh probably triggers patterns starting after
  1277. another pattern's landing or taking off.
  1278.  
  1279. -- 04h ------------- End of pattern (1 byte)
  1280. End of pattern record
  1281.  
  1282. Used to mark the end of a pattern. It is made of the single byte 04h.
  1283. -- 06h ------------- Teake off/land record (2 bytes)
  1284.  
  1285. A take off (land) record is inserted after the movement that caused the model
  1286. to rise over (to sink at) the ground level. Each of them is always followed
  1287. by the corresponding 02h FFFDh record.
  1288.  
  1289. 1         1    02h: take off (always followed by a 02 FFFD 0000 record)               03h: landing (always followed by a 02 FFFD 0002 record)
  1290.  
  1291. -- FFh ------------- Position record (21 bytes)
  1292.  
  1293. Position record is identical to initial record, excepted the record code and
  1294. the last field. It is used through the entire pattern description to mark
  1295. successive positions and orientations of the object.
  1296. 1         4    E coord  (fract. FSu)
  1297. 5         4    alt. AGL (fract. FSu)
  1298. 9         4    N coord  (fract. FSu)
  1299. 13        2    pitch (noze down is positive, noze up is negative)
  1300. 15        2    bank (left is positive, right is negative)
  1301. 17        2    direction
  1302. 19        2    time between the previous (or initial) position and this one
  1303. Note: The time interval between positions is apparently measured in ticks, 1
  1304. tick every 0.008 sec (or 126 ticks per sec). Time intervals are not constant
  1305. but shorter when the position (or orientation) variation is greater and
  1306. longer when it is smaller. It seems never to exceed ca 1500 ticks (12 sec).
  1307. About other fields, the same observations made for the initial record apply.
  1308.  
  1309. ====================
  1310. Patterns usually begin with:
  1311.  
  1312. record 02 FFFE           to define initial conditions
  1313. record 02 FFFB                "
  1314. record 02 FFFD                "
  1315. record 00                to define initial point and orientation
  1316.  
  1317. Then enough FFh records follow to define successive positions andorientations of the object. Change in visual aspects and flying condition are
  1318. marked by appropriate records. The pattern is closed by the
  1319.  
  1320. record 04
  1321.  
  1322. ========================================
  1323.  
  1324.                               DEMO FILES (.DEM)
  1325. Demo files, like dynamic sceneries, have a relatively simple structure and
  1326. record set. Basically, demo files describe successive positions (and
  1327. orientations) of the aircraft with a flow of position records; these records,
  1328. however, are intersparsed with single byte codes that correspond to the keys
  1329. pressed by the user during demo recording.
  1330. Contrarily to dynamic sceneries, aircraft position is sampled at a fixed rate
  1331. (either 1 or 5 sec) and all the codes for keys pressed between two samplesare grouped and inserted between the two corresponding position records.
  1332.  
  1333.                                   KEY CODES
  1334.  
  1335. Key codes correspond, in almost all cases, to the hardware press scan codes
  1336. generated by the keyboard and are, therefore, less than 80h.
  1337.  
  1338. Some kind of tanslation is, however, carried out by the demo recorder:
  1339. ∙ on all keyboards, some key codes are ignored and some other are converted
  1340.   to 00h
  1341. ∙ on 101-key keyboards, function keys are converted to their functional
  1342.   equivalent of the 83-key keyboard and the corresponding scan code is used
  1343. ∙ some keys of the numeric pad have the same function in the 101-key keyboard
  1344.   (like Gray /, Gray * and ScrollLock, or Gray + and Gray Enter) and their
  1345.   scan code are merged∙ scan code prefixes used by 101-key keyboards to differentiate among
  1346.   duplicated keys (left and right Alt and Ctrl, white and gray cursor
  1347.   keys...) are thrown away.
  1348. ∙ release scan code are ignored.
  1349.  
  1350. Excepted for a few special keys (like Shift, Ctrl and Alt), all key presses
  1351. are recorded, even if they do nothing.
  1352. Key presses are executed as soon as they are met during demo play back: they
  1353. affect the instrument panel, the display and outer world simulation in the
  1354. same way as during normal flight; apparently, however they do not affect
  1355. flight simulation which is based on the position records. Subsequent position
  1356. records are interpolated to simulate a continuous flight.
  1357.  
  1358. The following table lists all the key codes generated by the demo recorder
  1359. with their corresponding key; function key codes have two corresponding keys,the first is for 83-key keyboards, the second for 101-key keyboards.
  1360.  
  1361. All codes are in hex.
  1362.  
  1363. Alphanumeric keys
  1364.  
  1365. 01  Esc       0F  Tab       [1D ∙]        [2A ∙]        [38 ∙]
  1366. 02  '1'       10  'Q'       1E  'A'       [2B ∙]        39  Space03  '2'       11  'W'       1F  'S'       2C  'Z'       3A  CapsLk
  1367. 04  '3'       12  'E'       20  'D'       2D  'X'
  1368. 05  '4'       13  'R'       21  'F'       2E  'C'
  1369. 06  '5'       14  'T'       22  'G'       2F  'V'
  1370. 07  '6'       15  'Y'       23  'H'       30  'B'
  1371. 08  '7'       16  'U'       24  'J'       31  'N'
  1372. 09  '8'       17  'I'       25  'K'       32  'M'
  1373. 0A  '9'       18  'O'       26  'L'       33  ','0B  '0'       19  'P'       27  ';'       34  '.'
  1374. 0C  '-'       1A  '['       28  '''       35  '/'
  1375. 0D  '+'       1B  ']'       29  '`'       [36 ∙]
  1376. 0E  BkSp      1C  Enter                   37  '*'-PrtSc
  1377.  
  1378. Function keys               Numeric pad keys
  1379.  
  1380. 3B  F1/F5   3C  F2/F4       45  NumLk   46  Gr /|*|ScrollLk3D  F3/F6   3E  F4/F3       47  Home    48  Up      49  PgUp    4A  Gr -
  1381. 3F  F5/∙∙   40  F6/∙∙       4B  Left    4C  Pad 5   4D  Right   4E  Gr +|<─┘
  1382. 41  F7/F7   42  F8/F2       4F  End     50  Down    51  PgDn
  1383. 43  F9/F8   44  F10/F1      52  Ins     53  Del                 56 '<'∙∙∙
  1384.  
  1385. Notes:
  1386. ∙   Scan codes 1D, 2A, 2B, 36, 38 would correspond to Ctrl, Left Shift, '\',
  1387. Right Shift, Alt respectively; but within demos, Shift and '\' keys do notgenerate any code, while Ctrl and Alt keys generate a 00 code.
  1388.  
  1389. ∙∙  No F key of 101-key keyboard correspond to F5 and F6 of 83-key keyboard:
  1390. therefore those codes are never recorded with a 101-key keyboard
  1391.  
  1392. ∙∙∙ Code 56 is generated (and recorded) only with 102-key European keyboards.
  1393.  
  1394.                                    RECORDS
  1395. All records have a code >= 80h and are therefore easily differentiated from
  1396. key codes.
  1397.  
  1398. Only 8 kinds of records have been recognized and are listed below. The first
  1399. four of them are actually found in demo files generated by the demo recorder;
  1400. the other four have been found in the demo supplied with the program (the
  1401. default demo as well as the instructor flights of the flight school and thelead plane flights of the formation entertainement which are all regular demo
  1402. files), but are correctly played back if manually inserted in a recorded
  1403. demo.
  1404.  
  1405. A recorded demo has a very simple structure: it is made of sample rate
  1406. records (either 80h or 81h) followed by long position records; between a
  1407. position record and the next sample rate record, the codes for key pressed by
  1408. the user are inserted. The file is not divided in sections (like, forinstance, scenery files) nor its end is marked in any way.
  1409.  
  1410. -- 80h ------------- 1 sec (1 byte)
  1411.  
  1412. This single byte record marks a sample rate of 1 sec and is usually followed
  1413. by a long position record.
  1414.  
  1415. -- 81h ------------- 5 sec (1 byte)
  1416. This single byte record marks a sample rate of 5 sec and is usually followed
  1417. by a long position record.
  1418.  
  1419. -- 82h ------------- Long position record (19 bytes)
  1420.  
  1421. 1         4    E coord. (fract. FSu)
  1422. 5         4    Alt. AGL (fract. FSu)9         4    N coord. (fract. FSu)
  1423. 13        2    pitch (noze down is positive, noze up is negative)
  1424. 15        2    bank (left is positive, right is negative)
  1425. 17        2    heading
  1426.  
  1427. This record is usually preceded by a 1 sec or a 5 sec record.
  1428.  
  1429. --84h -------------- Message (mess.length+2 bytes)
  1430. 1         xx   Message text
  1431. 1+xx      1    00h
  1432.  
  1433. ====================
  1434.  
  1435. Supplied demos contain four more kinds of record, allowing for adding a major
  1436. feature (mode record) and for saving some bytes.
  1437. They usually begin with a mode record which sets the initial conditions; a 1
  1438. sec position record follows giving the aircraft initial position, then a flow
  1439. of short position records describes subsequent aircraft positions. As usual,
  1440. key codes are inserted among position records to interact with the simulator.
  1441.  
  1442. -- 8Ah ------------- Mode record (528 bytes)
  1443. 1         526  Mode
  1444. 527       1    8Bh: end of mode
  1445.  
  1446. This record embeds a full mode, with exactly the same structure of a .MOD
  1447. mode file; this allows specifying all the display, environment and flight
  1448. conditions within a demo.  Mode records are usually inserted at the beginnig
  1449. of a demo to prepare the field; other mode records can however appear
  1450. anywhere in a .DEM to change simulation parameters.
  1451. -- 90h ------------- 1 sec/position (19 bytes)
  1452.  
  1453. 1         4    E coord. (fract. FSu)
  1454. 5         4    Alt. AGL (fract. FSu)
  1455. 9         4    N coord. (fract. FSu)
  1456. 13        2    pitch (noze down is positive, noze up is negative)
  1457. 15        2    bank (left is positive, right is negative)17        2    heading
  1458.  
  1459. This record has the same structure of the 82h record, but contains also a 1
  1460. sec sample rate information.
  1461.  
  1462. -- 91h ------------- 5 sec/position (19 bytes)
  1463.  
  1464. 1         4    E coord. (fract. FSu)5         4    Alt. AGL (fract. FSu)
  1465. 9         4    N coord. (fract. FSu)
  1466. 13        2    pitch (noze down is positive, noze up is negative)
  1467. 15        2    bank (left is positive, right is negative)
  1468. 17        2    heading
  1469.  
  1470. This record has the same structure of the 82h record, but contains also a 5
  1471. sec sample rate information.
  1472. -- 94h ------------- Short position record (7 bytes)
  1473.  
  1474. This record describes the variations of the 6 position parameters relatives
  1475. to a previous position record (either a 90h record or another 94h record). It
  1476. can be used also after an 82h record, even if MS demos never do so.
  1477. The record includes also 1 sec of sample rate.
  1478. 1         1    E coord. delta
  1479. 2         1    Alt. delta
  1480. 3         1    N coord. delta
  1481. 4         1    Pitch delta
  1482. 5         1    Bank delta
  1483. 6         1    Heading delta
  1484.  
  1485. Linear parameters are in m, angular parameters in 1.4° (= 360° / 256); all 6parameters are signed: the max linear delta is therefore 127 m, and the max
  1486. angular delta is 180°.
  1487.  
  1488. Short position records save 12 bytes each over long position records.
  1489. Apparently, there is no short position record for 5 sec interval.
  1490.  
  1491. ========================================
  1492.  
  1493.  
  1494.                               MODE FILES (.MOD)
  1495.  
  1496. Mode files still have many obcure points, but almost all the parameters the
  1497. can be set from FS menu are decoded.  Exceptions are mouse sensitivity
  1498. parameters, because I do not use a mouse with FS (it seems to me like driving
  1499. a car with the foots), and joystick parameters because I do not have one (Iam a serious person, I don't play games!).
  1500.  
  1501. There is a lot of undecoded 1-byte fields; they are probably unused and maybe
  1502. are only the MSBytes of word fields which never exceed an 8-bit value.
  1503.  
  1504. Screen coordinates (for window positions) are apparently device-independent
  1505. (I tried on a VGA and a Hercules): ascissae span from 0032h to 1FD6h and
  1506. ordinates from 0032h to 17D4h; origin is in the upper left corner.
  1507. The following listing follows the same format used above, but, given the
  1508. length of the mode "record", a column with hex offset has been added.
  1509.  
  1510. Key labels (as <F1>) refer to the 101-key keyboard.
  1511.  
  1512.  
  1513.    0 0000   2  020Eh: file length   2 0002   2  0017h: pointer to mode name
  1514.    4 0004   1  01h: mode file signature
  1515.    5 0005   4  Initial E coord. (fract. FSu)
  1516.    9 0009   4  Initial AGL alt. (fract. FSu)
  1517.   13 000D   4  Initial N coord. (fract. FSu)
  1518.   17 0011   2  Initial pitch
  1519.   19 0013   2  Initial bank
  1520.   21 0015   2  Initial heading  23 0017  31  Mode name (padded with spaces and 0-terminated)
  1521.  
  1522.                FIRST 3D WINDOW
  1523.   54 0036   2  Left border position
  1524.   56 0038   2  Top border position
  1525.   58 003A   2  Width
  1526.   60 003C   2  Height
  1527.   62 003E   1  View:     00h    Cockpit                         01h    Tower
  1528.                          02h    Track
  1529.                          03h    Spot plane
  1530.   63 003F   1  Cockpit view direction: counterclockwise 00h front -> 07h
  1531.                front left
  1532.   64 0040   2  Cockpit view zoom:
  1533.                          0010h  .16 x
  1534.                          0020h  .33 x                         0040h  1 x
  1535.                          0081h  2 x
  1536.                          0103h  4 x
  1537.                          0207h  8 x
  1538.                          040Fh  16 x
  1539.                          081Fh  32 x
  1540.                          103Fh  64 x
  1541.                          207Fh  129 x                         40FFh  256 x
  1542.                          7FFFh  511 x
  1543.   66 0042   2  Tower view zoom (as above)
  1544.   68 0044   2  Track view zoom (as above)
  1545.   70 0046   2  Spot plane view zoom (as above)
  1546.   72 0048   1
  1547.   73 0049   1  Spot view direction: counterclockwise 00h front -> E0h front
  1548.                left (01h = 1.4°)  74 004A   2  Spot plane distance (in 1/256 m)
  1549.   76 004C   2
  1550.   78 004E   1  Spot plane preference:  00h roll  -  01h loop
  1551.   79 004F   1  Spot plane transition:  00h slow  -  01h fast
  1552.   80 0050   2  Spot plane altitude (in 1/256 m)
  1553.   82 0052  28  ?? (these bytes change when the cockpit view direction
  1554.                changes, but without any clear pattern)
  1555.                SECOND 3D WINDOW
  1556.  110 006E   2  Left border position
  1557.  112 0070   2  Top border position
  1558.  114 0072   2  Width
  1559.  116 0074   2  Height
  1560.  118 0076   1  View:     00h    Cockpit
  1561.                          01h    Tower
  1562.                          02h    Track                         03h    Spot plane
  1563.  119 0077   1  Cockpit view direction: counterclockwise 00h front -> 07h
  1564.                front left
  1565.  120 0078   2  Cockpit view zoom (see byte 64)
  1566.  122 007A   2  Tower view zoom (as above)
  1567.  124 007C   2  Track view zoom (as above)
  1568.  126 007E   2  Spot plane view zoon (as above)
  1569.  128 0080   1 129 0081   1  Spot view direction: counterclockwise 00h front -> E0h front
  1570.                left (01h = 1.4°)
  1571.  130 0082   2  Spot plane distance (in 1/256 m)
  1572.  132 0084   2
  1573.  134 0086   1  Spot plane preference:  00h roll  -  01h loop
  1574.  135 0087   1  Spot plane transition:  00h slow  -  01h fast
  1575.  136 0088   2  Spot plane altitude (in 1/256 m)
  1576.  138 008A  28  ?? (these bytes change when the cockpit view direction               changes, but without any clear pattern)
  1577.  
  1578.  166 00A6   2  Map window left border position
  1579.  168 00A8   2  Map window top border position
  1580.  170 00AA   2  Map window width
  1581.  172 00AC   2  Map window height
  1582.  174 00AE   1  Current window:
  1583.                          00h    first 3D                         01h    second 3D
  1584.                          02h    map
  1585.  175 00AF   1  First 3D:  00h off  -  01h on
  1586.  176 00B0   1  Second 3D:  00h off  -  01h on
  1587.  177 00B1   1  Map:  00h off  -  01h on
  1588.  178 00B2   1  Position indic.:  00h off  -  01h on
  1589.  179 00B3   1  Instr. panel:  00h off  -  01h on
  1590.  180 00B4   1  Full external view:  00h off  -  01h on 181 00B5   1
  1591.  182 00B6   1  Titles on windows:  00h off  -  01h on
  1592.  183 00B7   1
  1593.  184 00B8   1  Shader:  00h off  -  01h on
  1594.  185 00B9   1
  1595.  186 00BA   1  Stars:  00h off  -  01h on
  1596.  187 00BB   1
  1597.  188 00BC   1  Ground text.:  00h off, 01h dots, 02h small rect, 03h big rect 189 00BD   1  Crash:  00h off, 01h detect, 02h detect and analyse
  1598.  190 00BE   1  Sound:  00h off  -  01h on
  1599.  191 00BF   1  Pause:  00h off  -  01h on
  1600.  192 00C0   1  Realism, bits (realism scale is at offset 299):
  1601.                          0      engine
  1602.                          1      elevator trim
  1603.                          2      gyro drift
  1604.                          3      light burn                         4      fast throttle
  1605.                          5      instrument lights
  1606.                          6      barometer drift
  1607.                          7      [unused]
  1608.  193 00C1   1  Axis indicator:
  1609.                          00h    none
  1610.                          01h    V-shaped
  1611.                          02h    4-dots                         03h    small V
  1612.  194 00C2   1  Auto coordination:  00h off  -  01h on
  1613.  195 00C3   1
  1614.  196 00C4   1  Smoke system:  00h off  -  01h on
  1615.  197 00C5   1
  1616.  198 00C6   1  ATC comm:  00h off  -  01h 0n
  1617.  199 00C7   1
  1618.  200 00C8   1  Slew:  00h off  -  01h on 201 00C9   3  ??
  1619.  204 00CB   2  Rotat. slew: negative = right, positive = left (+- 80h each
  1620.                <End> or <PgDn>)
  1621.  206 00CE   1
  1622.  207 00CF   1  Altit. slew:  00h max up -> 40h stable -> 7Fh max down (+- 02h
  1623.                each <A> or <Q>, <F1> -> 7Fh, <F4> -> 00h)
  1624.  208 00D0   1
  1625.  209 00D1   1  Longit. slew: negative = forward, positive = rear (+-01h each               <Down> or <Up>)
  1626.  210 00D2   1
  1627.  211 00D3   1  Side slew: negative = left, positive = right (+-01h each
  1628.                <Right> or <Left>)
  1629.  212 00D4   2  ??
  1630.  214 00D6   1  EFIS/CFPD:  00h off  -  01h on (equal to byte 394)
  1631.  215 00D7   3  ??
  1632.  218 00DA   3  Hours, min and sec as hex numbers 221 00DD  12  ??
  1633.                Instrument panel display (instr. displayed when bit set):
  1634.  233 00E9   1  bits:     0      airspeed
  1635.                          1      turn coordination
  1636.                          2      gyro heading
  1637.                          3      altimeter
  1638.                          4      attitude
  1639.                          5      VOR 1                         6      tacheometer
  1640.                          7      vertical velocity
  1641.  234 00EA   1  bits:     0      time
  1642.                          1      transponder
  1643.                          2      NAV 1
  1644.                          3      COM
  1645.                          4      compass
  1646.                          5      fuel                         6      oil
  1647.                          7      AUX 2
  1648.  235 00EB   1  bits:     0      gear and carb heat
  1649.                          1      NAV 2
  1650.                          2      DME
  1651.                          3      VOR 2
  1652.                          4      ADF
  1653.                          5      AUX 1                         6      AUX 4
  1654.                          7      AUX 3
  1655.  236 00EC   5  ??
  1656.  
  1657.                WINDS
  1658.  241 00F1   1  Layer 3 speed (in kt)
  1659.  242 00F2   1  Layer 3 turbulence:  00h -> 0Ah
  1660.  243 00F3   2  Layer 3 direction (in 1/182.04°) 245 00F5   1  Layer 2 speed (in kt)
  1661.  246 00F6   1  Layer 2 turbulence:  00h -> 0Ah
  1662.  247 00F7   2  Layer 2 direction (in 1/182.04°)
  1663.  249 00F9   1  Layer 1 speed (in kt)
  1664.  250 00FA   1  Layer 1 turbulence:  00h -> 0Ah
  1665.  251 00FB   2  Layer 1 direction (in 1/182.04°)
  1666.  253 00FD   1  Surface speed (in kt)
  1667.  254 00FE   1  Surface turbulence:  00h -> 0Ah 255 00FF   2  Surface direction (in 1/182.04°)
  1668.  257 0101   2  Layer 3 tops (in m)
  1669.  259 0103   2  Layer 3 base (in m)
  1670.  261 0105   2  Layer 2 tops (in m)
  1671.  263 0107   2  Layer 2 base (in m)
  1672.  265 0109   2  Layer 1 tops (in m)
  1673.  267 010B   2  Layer 1 base (in m)
  1674.  269 010D   2  Surface depth (in m)
  1675.                CLOUDS
  1676.  271 010F   2  Top layer tops (in m)
  1677.  273 0111   2  Top layer base (in m)
  1678.  275 0113   2  Top layer coverage:  00h clear  ->  08h overcast
  1679.  277 0115   2  Top layer deviation (in m)
  1680.  279 0117   2  Bottom layer tops (in m)
  1681.  281 0119   2  Bottom layer base (in m) 283 011B   2  Bottom layer coverage:  00h clear  ->  08h overcast
  1682.  285 001D   2  Bottom layer deviation (in m)
  1683.  287 011F   2  Thunderstrom tops (in m)
  1684.  289 0121   2  Thunderstorm base (in m)
  1685.  291 0123   2  Thunderstorm coverage:  00h widely scatt.  ->  02h dense
  1686.  293 0125   2  Thunderstorm speed (in 1/2 kt)
  1687.  295 0127   2  Thunderstorm direction (in 1/182.04°)
  1688.  297 0129   1  Reliability:  00h  ->  64h 298 012A   1
  1689.  299 012B   1  Realism:  00h  ->  64h
  1690.  300 012C   1
  1691.  301 012D  26  ?? this portion contains mouse and joystick parameters
  1692.  327 0147   1  Keyboard aileron sensibility:  01h = 1 -> 7Fh = 8
  1693.  328 0148   1
  1694.  329 0149   1  Keyboard elevator sensibility:  01h = 1 -> 7Fh = 8
  1695.  330 014A   1 331 014B   1  Keyboard rudder sensibility:  01h = 1 -> 7Fh = 8
  1696.  332 014C   3  ??
  1697.  335 014F   2  Panel instrument top border
  1698.  337 0151   2  ??
  1699.  339 0153   1  Season:  00h winter -> 03h autumn
  1700.  341 0155   6  COM freq as ASCII string of the form "120;30"
  1701.  347 015B   1  always 0 ??
  1702.  348 015C   1  NAV1 active:  00h off  -  01h on 349 015D   6  NAV1 freq as ASCII string of the form "120;30"
  1703.  355 0163   1  always 0 ??
  1704.  356 0164   1  NAV2 active:  00h off  -  01h on
  1705.  357 0165   6  NAV2 freq as ASCII string of the form "120;30"
  1706.  363 016B   3  OBI1 inbound course as ASCII string of the form "120"
  1707.  366 016E   1  always 0 ??
  1708.  367 016F   1  VOR1 active:  00h off  -  01h on
  1709.  368 0170   3  OBI1 outbound course as ASCII string of the form "120" 371 0173   1  always 0 ??
  1710.  372 0174   1  VOR2 active:  00h off  -  01h on
  1711.  373 0175   3  OBI2 inbound course as ASCII string of the form "120"
  1712.  376 0178   1  always 0 ??
  1713.  377 0179   1  VOR2 active:  00h off  -  01h on
  1714.  378 017A   3  OBI2 outbound course as ASCII string of the form "120"
  1715.  381 017D   1  always 0 ??
  1716.  382 017E   1  Transponder active:  00h off  -  01h on 383 017F   4  Transponder freq as ASCII string of the form "1200"
  1717.  387 0183   1  always 0 ??
  1718.  388 0184   1  ADF active:  00h off  -  01h on
  1719.  389 0185   3  ADF freq as ASCII string of the form "120"
  1720.  392 0188   1  EFID/CFPD function:
  1721.                          00h    none
  1722.                          01h    lock to ILS for landing approach
  1723.                          02h    lock to navaid and alt. tracking 393 0189
  1724.  394 018A   1  EFIS/CFPD:  00h off  -  01h on (equal to byte 214)
  1725.  395 018B   1
  1726.  396 018E   1  EFIS/CFPD type:  00h rect,  01h bricks,  02h poles
  1727.  397 018F   1
  1728.  398 0190   1  EFIS/CFPD density:  00h thick,  01h medium,  02h thin
  1729.  399 0191   1
  1730.  400 0192   1  EFIS/CFPD range:  00h short,  01h medium,  02h long 401 0193   1
  1731.  402 0194   1  EFIS/CFPD navaid:  00h NAV1,  01h NAV2
  1732.  403 0195   1
  1733.  404 0196   2  EFIS/CFPD tracking altitude (in m)
  1734.  406 0198  66  ???? (this portion apparently contains, among other things,
  1735.                the dynamic parameters (velocity vector, angular
  1736.                velocities...), but no clear relation has emerged)
  1737.  472 01D8   1  Elevator 'carry':  01h when full pushed, FFh when full pulled,               00h otherwise
  1738.  473 01D8   1  Elevator:  C0h full pushed -> 3F full pulled; +-01h each
  1739.                <Down> or <Up>
  1740.  474 01D9   1  Aileron 'carry':  01h when at full left, FFh when at full
  1741.                right, 00h otherwise
  1742.  475 01DA   1  Ailerons:  C0h full left -> 3Fh full right; +- 04h each
  1743.                <Rigth> or <Left>
  1744.  476 01DB   1  Rudder 'carry':  01h when at full left, FFh when at full               right, 00h otherwise
  1745.  477 01DC   1  Rudder:  C0h full left -> 3Fh full right; +- 04h each <Rigth>
  1746.                or <Left>
  1747.  478 01DE   1  Throttle 'carry':  FFh when full, 00h otherwise
  1748.  479 01DF   1  Throttle:  00h cut -> 3Fh full; +-02h each <PgUp> or <PgDn>
  1749.  480 01E0   1  Trim 'carry':  01h when full down, FFh when full up, 00h
  1750.                otherwise
  1751.  481 01E1   1  Trim:  C0h full down -> 3F full up; +-01h each <End> or <Home> 482 01E2  10  ??
  1752.  492 01EC   2  Position indic. window left border
  1753.  494 01EE   2  Position indic. window top border
  1754.  496 01F0   4  Tower E coord (fract FSu)
  1755.  500 01F4   4  Tower AGL alt (fract FSu)
  1756.  504 01F8   4  Tower N coord (fract FSu)
  1757.  508 01FC   2  ??
  1758.  510 01FE   1  Flap 'carry':  FFh when flap down, 00h otherwise 511 01FF   1  Flap:     00h    0°
  1759.                          20h    10°
  1760.                          40h    20°
  1761.                          60h    30°
  1762.                          7Fh    40°
  1763.  512 0200   1  Gear:  00h up  -  FFh down
  1764.  513 0201   1  Lights:  00h off  -  FFh on
  1765.  514 0202   1  Mags:     00h    off                         01h    left
  1766.                          02h    right
  1767.                          03h    both
  1768.                          04h    start
  1769.                          05h    lean
  1770.  515 0203   1
  1771.  516 0204   1  Carb heat:  00h off  -  FFh on
  1772.  517 0205   1  Strobe:  00h off  -  01h on 518 0206   8  .SIM file name. .SIM files define the visual appearance of the
  1773.                aircraft; the name is padded with space if shorter than 8
  1774.                chars. No path nor extension are allowed (a standard .SIM
  1775.                extension is apparently supplied by the program)
  1776.                          FS4 .SIMs:
  1777.                SIM1.SIM         Cessna R182
  1778.                SIM2.SIM         Gates Learjet 25G
  1779.                SIM3.SIM         Schweizer 2-32 Sailplane               SIM4.SIM         Sopwith Camel
  1780.                SIM5.SIM         Experimental aircraft
  1781.                          ASD .SIMs:
  1782.                SIM7.SIM         Experimental jet aircraft
  1783.                SIM8.SIM         Experimental sailplane
  1784.                SIM9.SIM         Boeing 747-400
  1785.                SIMA.SIM         Beechcraft Starship
  1786.                SIMB.SIM         Piper Cherokee Archer II               SIMC.SIM         Cessna 182 seaplane
  1787.  
  1788. ========================================
  1789.  
  1790.  
  1791.  
  1792.                APPENDIX: A NOTE ON F1 (DEFAULT SCENERY) HEADER
  1793. The following note is a first step in attempting to decode the default
  1794. scenery F1 supplied with FS.  Only the initial file header is covered.  It
  1795. has been checked with sceneries supplied with FS veriosn 4.0 and 4.0b.  They
  1796. are different, but perhaps only marginally and, in any case, not in the
  1797. portion covered here.
  1798.  
  1799. 0000h     2    02DDh: ??
  1800. 0002h     2    0106h: pointer to dialogue descriptor (see below)0004h     28   ??
  1801. 0020h     2    0026h: number of scenery regions in the file
  1802.  
  1803. Then, a table is given with, for each scenery region:
  1804.  
  1805.           4    long pointer to region offset in the file
  1806.           2    region length in bytes
  1807. Table ends at 0106h. A descriptor of the dialogue window displayed when the
  1808. scenery is selected follows:
  1809.  
  1810. 0106h     1    01h: ??
  1811. 0107h     2    01F4h: X screen coordinate of text line
  1812. 0109h     2    0258h: Y screen coordinate of text line
  1813. 010Bh     25   text line: "Available Flight Areas:" 0-terminated and with
  1814.                a 0 byte added at both ends
  1815. This is repeated for the 7 text lines up to
  1816.  
  1817. 0186h     5    00h 3Ch 00h FFh 28h  ??
  1818. 018Bh     35   two 21h records and one 79h record
  1819.  
  1820. After that, the first scenery begins. I sampled them at random and they seems
  1821. to be made of the same record machinery (maybe with some new record types) ofother kinds of scenery, but have no header or section tables as .SC1 files
  1822. do.  F1, as well as *.SCN, do not use a linked list of 3Eh records, but a
  1823. linked list of many kinds of record (21h occurring very often).
  1824.  
  1825.  
  1826. ==================== FSSTRUCT END ====================